using Framework;
using Framework.DataTable;
using UnityEngine;
public class Vector3Ext : IDataParser
{
    public static Vector3 DeserializeObject(string value)
    {
        var v3 = new Vector3();
        if (string.IsNullOrEmpty(value)) return v3;
        var lst = Framework.Utils.Parse.ParseList(value);
        var len = lst.Length;
        if (len > 0)
        {
            v3.x = float.Parse(lst[0]);
        }
        if (len > 1)
        {
            v3.y = float.Parse(lst[1]);
        }
        if (len > 2)
        {
            v3.z = float.Parse(lst[2]);
        }
        return v3;
    }
    public static void Encode(Vector3 value, ByteArray buffer)
    {
        buffer.Write(value.x);
        buffer.Write(value.x);
        buffer.Write(value.x);
    }
    public static Vector3 Decode(ByteArray buffer)
    {
        var v3 = new Vector3();
        v3.x = buffer.ReadFloat();
        v3.y = buffer.ReadFloat();
        v3.z = buffer.ReadFloat();
        return v3;
    }
    public static string SerializeObject(Vector3 value, string type)
    {
        return "{\"x\":" + value.x + ",\"y\":" + value.y + value.x + ",\"z\":" + value.z + "}";
    }
    public string GetTypeName()
    {
        return typeof(Vector3).FullName;
    }
    public string[] GetStaticMethodNames()
    {
        return new string[] { nameof(DeserializeObject), nameof(Encode), nameof(Decode), nameof(SerializeObject) };
    }
    public string ToString(string type)
    {
        return "";
    }
}
public class SceneExitData : IDataParser
{
    public int SceneId;
    public int EnterId;
    public static SceneExitData DeserializeObject(string value)
    {
        var data = new SceneExitData();
        var lst = Framework.Utils.Parse.ParseList(value);
        var len = lst.Length;
        if (len > 0)
        {
            data.SceneId = int.Parse(lst[0]);
        }
        if (len > 1)
        {
            data.EnterId = int.Parse(lst[1]);
        }
        return data;
    }
    public static void Encode(SceneExitData value, ByteArray buffer)
    {
        buffer.Write(value.SceneId);
        buffer.Write(value.EnterId);
    }
    public static SceneExitData Decode(ByteArray buffer)
    {
        var d = new SceneExitData();
        d.SceneId = buffer.ReadInt();
        d.EnterId = buffer.ReadInt();
        return d;
    }

    public string GetTypeName()
    {
        return typeof(SceneExitData).FullName;
    }
    public string[] GetStaticMethodNames()
    {
        return new string[] { nameof(DeserializeObject), nameof(Encode), nameof(Decode) };
    }
}